#include<cstdio>//uncle-lu
#include<algorithm>
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9') { f|=(ch=='-'); ch=getchar(); }
	while(ch<='9'&&ch>='0') { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
	x = f ? -x : x;
	return ;
}

int n, m;
int F[110][110], pre[110][110];
int map[110][110];

void print(int x, int y)
{
	if(x == 0)return ;
	print(x-1, pre[x][y]);
	printf("%d ", y);
	return ;
}

int main()
{
	read(n);read(m);
	for (int i = 1; i <= n; i++) 
		for (int j = 1; j <= m; j++) 
			read(map[i][j]);

	for (int i = 1; i <= n; i++) 
	{
		for (int j = i; j <= m; j++) 
		{
			F[i][j] = F[i-1][j-1] + map[i][j];
			pre[i][j] = j-1;
			for (int k = i-1; k <= j-1; k++) 
				if(F[i][j] < F[i-1][k] + map[i][j])
				{
					F[i][j] = F[i-1][k] + map[i][j];
					pre[i][j] = k;
				}
		}
	}

	int ans = 0, sit = 0;
	for (int i = 1; i <= m; i++) 
		if(ans < F[n][i])
		{
			ans = F[n][i];
			sit = i;
		}

	printf("%d\n", ans);
	print(n, sit);

	return 0;
}
